package com.party.common;

import com.party.model.SysAreas;
//import com.party.parBean.Bank;
//import com.party.parBean.SysConf;
import com.party.parBean.UserMsg;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 全局数据缓存中心
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 11-7-4
 * Time: 下午3:50
 * To change this template use File | Settings | File Templates.
 */
public class GlobleData {
    //系统配置基础对象
//    public static SysConf sysConfobj = new SysConf();
    //用户数据map
    public static Map<String, UserMsg> users = new ConcurrentHashMap<String, UserMsg>();
    //支付类型及编号信息
    public static Map<String, String> payShop = new ConcurrentHashMap<String, String>();
    //系统配置基础参数
    public static Map<String, String> sysConf = new ConcurrentHashMap<String, String>();
    //系统密保问题缓存
    public static Map<String, String> pwdProqus = new ConcurrentHashMap<String, String>();


    //地区数据缓存   key：areaid 地区id  value:地区对象
    public static Map<Integer, SysAreas> areaSource = new ConcurrentHashMap<Integer, SysAreas>();
    //省级编号列表
    public static List<SysAreas> provinceList = new ArrayList<SysAreas>();

    //省级对应的市级列表    key：省id   value:对应市列表
    public static Map<Integer, List<SysAreas>> cityMap = new ConcurrentHashMap<Integer, List<SysAreas>>();

    //市级对应的地区列表    key：市id   value:对应的地区列表
    public static Map<Integer, List<SysAreas>> areaMap = new ConcurrentHashMap<Integer, List<SysAreas>>();


//    //字典数据缓存
//    public static Map<String, Map<String, String>> DbDictMap = new ConcurrentHashMap<String, Map<String, String>>();
//
//    //地区数据缓存   key：area_id  value: 名称
//    public static Map<String, String> areaSource = new ConcurrentHashMap<String, String>();
//
//    //省级编号列表
//    public static List<String> ProvinceList = new ArrayList<String>();
//
//    //省级对应的市级列表
//    public static Map<String, List<String>> CityMap = new ConcurrentHashMap<String, List<String>>();
//
//    //市级对应的地区列表
//    public static Map<String, List<String>> areaMap = new ConcurrentHashMap<String, List<String>>();

     //银行信息
//     public static Map<String, Bank> banks = new ConcurrentHashMap<String, Bank>();

    /**
     * 根据支付名称获取支付的ID
     *
     * @param payname 支付方式的名称
     * @return
     */
    public static String getPayShopID(String payname) {
        String value = "";
        for (Map.Entry<String, String> entry : payShop.entrySet()) {
            String key = entry.getKey();
            String val = entry.getValue();
            if (payname.equals(val)) {
                value = key;
                break;
            }
        }
        return value;
    }

    /**
     * 根据银行的名称获取银行的编号
     *
     * @param bankName 银行的名称
     * @return
     */
//    public static String getBankCode(String bankName) {
//        String value = "";
//        for (Map.Entry<String, String> entry : bankCode.entrySet()) {
//            String key = entry.getKey();
//            String val = entry.getValue();
//            if (bankName.equals(val)) {
//                value = key;
//                break;
//            }
//        }
//        return value;
//    }
}
